/*------------------------------------------------------------------------------------------------\
| Horrible X-Wing game by Steven Haber
| st_haber@hotmail.com
|
| enemy.h: contains class Ai, which generates enemies based on "modes"
\------------------------------------------------------------------------------------------------*/

#ifndef AI_H
#define AI_H

#include "xwing.h"

class Sound;
class Craft;
class Enemy;

enum modes{SIMPLE, SIMPLE_TWO, SIMPLE_THREE, NUMBERMODES};

class Ai
{
public:
	Ai(sf::Sprite craftSprite, sf::Sprite *layzarSprite, int offsetX, int offsetY, sf::RenderWindow *out, Sound *sounds, int scoreValue);
	void go(float delta);
	void manualModeSet(bool yes);
	void setMode(int mode);
	void setManual(bool manual);
	
	int getNumberEnemies();
	int collisionCheck(int enemyNumber, Craft *craft);
	Craft *getCraft(int enemyNumber);
	bool hurt(int enemyNumber, int amount);
	void kill(int enemyNumber);
	int getScore();

	void drawLayzars(float delta);
	void drawEnemies();

private:
	int mCurrentMode;
	int mNextMode;
	bool mManual;
	int mNumberEnemies;
	int mLayzarOffsetX;
	int mLayzarOffsetY;
	bool mResetting;
	int mScore;

	sf::Clock mTimer;
	sf::Clock mTimer2;
	sf::Clock mEnemyTimer[NUMBERENEMIES];
	sf::RenderWindow *mOut;
	sf::Sprite mCraftSprite;
	sf::Sprite *mLayzarSprite;
	
	Enemy *mEnemies[NUMBERENEMIES];
	Sound *mSounds;

	void spawnEnemy(float initialX);
};

#endif